<nz-spin [nzSpinning]="isBusy">
    <form nz-form [formGroup]="formGroup">
        <nz-form-item>
            <nz-form-label [nzSpan]="5">信息系统</nz-form-label>
            <nz-form-control [nzSpan]="19" [nzErrorTip]="infoSystemError">
                <nz-select nzAllowClear nzPlaceHolder="请选择" formControlName="selectedInfoSystemNo"
                           [(ngModel)]="selectedInfoSystemNo">
                    <nz-option *ngFor="let infoSystem of infoSystems" [nzValue]="infoSystem.number"
                               [nzLabel]="infoSystem.name"></nz-option>
                </nz-select>
                <ng-template #infoSystemError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        信息系统不可为空！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="5">应用程序类型</nz-form-label>
            <nz-form-control [nzSpan]="19" [nzErrorTip]="applicationTypeError">
                <nz-select nzAllowClear nzPlaceHolder="请选择" formControlName="selectedApplicationType"
                           [(ngModel)]="selectedApplicationType">
                    <nz-option *ngFor="let applicationType of applicationTypes"
                               [nzValue]="applicationType.key"
                               [nzLabel]="applicationType.value"></nz-option>
                </nz-select>
                <ng-template #applicationTypeError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        应用程序类型不可为空！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="5">权限名称</nz-form-label>
            <nz-form-control [nzSpan]="19" [nzErrorTip]="authorityNameError">
                <input nz-input type="text" formControlName="authorityName" [(ngModel)]="authorityName"/>
                <ng-template #authorityNameError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        权限名称不可为空！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="5">权限路径</nz-form-label>
            <nz-form-control [nzSpan]="19" [nzErrorTip]="authorityPathError">
                <input nz-input type="text" formControlName="authorityPath" [(ngModel)]="authorityPath"/>
                <ng-template #authorityPathError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        权限路径不可为空！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="5">描述</nz-form-label>
            <nz-form-control [nzSpan]="19">
                <textarea rows="3" nz-input formControlName="description" [(ngModel)]="description"></textarea>
            </nz-form-control>
        </nz-form-item>
    </form>
</nz-spin>
<div class="form-footer">
    <nz-space>
        <button type="submit" nz-button *nzSpaceItem nzType="primary" [nzLoading]="isBusy" (click)="submit()">
            确定
        </button>
        <button type="button" nz-button *nzSpaceItem (click)="cancel()">
            取消
        </button>
    </nz-space>
</div>
